package com.blb.community.pojo.fourMenu;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Objects;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class FourMenu {
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long value;
    private String text;
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long parentId;
    private List<FourMenu> children;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FourMenu fourMenu = (FourMenu) o;
        return Objects.equals(value, fourMenu.value) &&
                Objects.equals(text, fourMenu.text) &&
                Objects.equals(parentId, fourMenu.parentId) &&
                Objects.equals(children, fourMenu.children);
    }

    @Override
    public int hashCode() {
        return Objects.hash(value, text, parentId, children);
    }
}
